import openpyxl
import py_excel_class
import pymysql_b
import pymysql

r_exce = py_excel_class.Readexcel.read_excel(r"D:\桌面\user.xlsx", "sheet01")

#
# sql="""CREATE TABLE if not exists  user_info (
#   id int(11) ,
#   idcard varchar(50) ,
#   username varchar(50) ,
#   realname varchar(50) ,
#   pwd varchar(50) ,
#   telphone varchar(12) ,
#   email varchar(100) ,
#   age int(11) ,
#   sex varchar(20) ,
#   address varchar(200) ,
#   hiredate date ,
#   sal double(9,2) ,
#   job varchar(100) ,
#   company varchar(100)
# ) """
sql_a = """
INSERT INTO user_info(
    id, idcard, username, realname, pwd, telphone, 
    email, age, sex, address, hiredate, sal, job, company
) 
VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
"""
py_sql=pymysql_b.Dbutils('localhost', 'root', '123456', 'test02')
for i in r_exce:
    a=tuple(i)
    py_sql.update(sql_a,a)


